package com.wfw.second.controller;

import com.wfw.common.pojo.TestVo;
import com.wfw.second.config.OtherProper;
import com.wfw.second.feign.FirstFeignService;
import com.wfw.second.service.SentinelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.UUID;

/**
 * @ Author     ：duanchao
 * @ Date       ： 10:23 2021/1/5
 * @ Description：
 */
@RestController
@RequestMapping("/second")
public class SecondController {

    @Autowired
    FirstFeignService firstFeignService;


    @Autowired
    SentinelService sentinelService;




    @GetMapping("/test")
    public String test(){
        System.out.println("sssssss");
//        String uuid = firstFeignService.getUUid();
        String uuid = sentinelService.getUUid();
        return  uuid;
    }

    @GetMapping("/test2")
    public String test2(){
        System.out.println("213132");
//        String uuid = UUID.randomUUID().toString();
        String uuid = sentinelService.getUUid();
        return  uuid;
    }

    @GetMapping("/test/pojo")
    public String testPojo(TestVo testVo){
        String uuid = firstFeignService.testGetPojo(testVo);
        return  uuid;
    }

    @GetMapping("/test/params")
    public void testParams(TestVo testVo){

        String uname = testVo.getUname();

        Integer age = testVo.getAge();

        String fristParam = firstFeignService.firstParam(uname);

        System.out.println(fristParam);

        TestVo secondParam = firstFeignService.secondParam(uname, age);

        System.out.println(secondParam);
        String obj = firstFeignService.testGetPojo(testVo);
        System.out.println(obj);
        String postfristParam = firstFeignService.postFirstParam(uname);
        System.out.println(postfristParam);
        String postsecondParam = firstFeignService.postSecondParam(uname,age);
        System.out.println(postsecondParam);
        String postobj = firstFeignService.postTestGetPojo(testVo);
        System.out.println(postobj);
    }


}